<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
	<link rel="stylesheet" type="text/css" href="__CSS__/common.css" />
	<link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css" />
	<script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="__EXTEND__/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
	<![endif]-->
	<title></title>
</head>
<body>
<div class="contant">
<div class="row">
	<h3 class="page-header">通知公告&nbsp;&nbsp;<small><gt name='info.id' value='0'>修改<else/>添加</gt>公告</small></h3>
</div>
<div class="row">
	<div class="panel panel-default">
		<div class="panel-body">
			<form role="form" id="myform" method="post"  class="form-horizontal" onsubmit="return dosubmit()">
			    <div class="form-group">
			        <label class="col-sm-3 control-label">公告标题：<span class="red">*</span></label>
			        <div class="col-sm-4">
			        	<input class="form-control required" name="title" value="{$info.title}" maxlength='50'>
			        </div>
			    </div>
			    <div class="form-group">
			        <label class="col-sm-3 control-label">排序：</label>
			        <div class="col-sm-4">
			        	<input class="form-control digits" name="sort" value="{$info.sort|default=100}">
			        </div>
			        <small>请输入正整数</small>
			    </div>
		        <div class="form-group">
		            <label class="col-sm-3 control-label">公告内容：<span class="red">*</span></label>
		            <div class="col-sm-4">
		           		<textarea rows="3" class="form-control" name="desc" id="description" placeholder="请填写公告内容">{$info.desc}</textarea>
		            </div>
		        </div>
		        <gt name='info.id' value='0'> <input type='hidden' name='id' id="id" value='{$info.id}'></gt>
		        <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-5">
                         <input type="hidden" name="id" value="{$info.id}" />
				        <button class="btn btn-primary" id="submit" type="submit">提交</button>
				       	<a href="{:U('Notice/index')}"><button class=" btn btn-default" type="button">返回</button></a>
		       		</div>
		       	</div>
			</form>
		</div>
	</div>
</div>
</div>
<script type="text/javascript">
	function dosubmit(){
	    //获取表单提交按钮
	    var btnSubmit = document.getElementById("submit");
		var title = $('input[name="title"]').val();
		var des   = $('#description').val();

		console.log(title);
		console.log(des);

	    if (title == ''){
	    	alert('公告标题未填写');
	    	$('input[name="title"]').focus();
	    	return false;
	    }

	    if (des.length == 0){
	    	alert('公告内容未填写');
	    	$('#description').focus();
	    	return false;
	    }else{
		    //将表单提交按钮设置为不可用，这样就可以避免用户再次点击提交按钮
		    btnSubmit.disabled= "disabled";
		    //返回true让表单可以正常提交
		    return true;
	    }

	    return false;
	}
</script>
</body>
</html>